<template>
  <footer class="footer">
    <span class="todo-count">剩余<strong>{{ count }}</strong></span>
    <ul class="filters">
      <li>
        <a :class="{selected:str==='all'}" href="javascript:;" @click.prevent="check('all')">全部</a>
      </li>
      <li>
        <a :class="{selected:str==='not'}" href="javascript:;" @click.prevent="check('not')">未完成</a>
      </li>
      <li>
        <a :class="{selected:str==='done'}" href="javascript:;" @click.prevent="check('done')">已完成</a>
      </li>
    </ul>
    <button class="clear-completed" @click="$emit('clear')">清除已完成</button>
  </footer>
</template>

<script>
export default {
  props: {
    count:{
      require:true,
      type:Number
    },
  },
  data(){
    return {
      str: 'all'
    }
  },
  methods:{
    check(str){
      this.$emit('check',str)
      this.str=str
    }
  }
};
</script>